package com.item.Controller;

import com.item.Models.User;
import com.item.Util.CommonResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;


@RestController
public class UserController {
    public static HashMap<Long, User> hashMap = new HashMap<>();

    static {
        hashMap.put(1L, new User());
        hashMap.put(2L, new User());
        hashMap.put(3L, new User());
    }

    @Value("${server.port}")
    private String serverPort;

    @GetMapping(value = "/paymentSQL/{id}")
    public CommonResult<User> paymentSQL(@PathVariable("id") Long id) {
        User user = hashMap.get(id);
        CommonResult<User> result = new CommonResult(200, "from mysql,serverPort:   " + serverPort, user);
        return result;
    }


}
